import java.io.*;
public class DelClasses
{
	public static void main(String[] args){
		try{
			File rootDir = new File(System.getProperty("user.dir"));
			deleteClassFiles(rootDir);
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	public static void deleteClassFiles(File dir){
		
		File[] subFiles = dir.listFiles();
		if(subFiles == null || subFiles.length == 0){
			return ;
		}

		for(File eachSubFile : subFiles){
			if(eachSubFile.isFile()){
				if(isClassFile(eachSubFile)){
					eachSubFile.delete();
				}	
			}else{
				deleteClassFiles(eachSubFile);
			}
		}
	}

	public static boolean isClassFile(File file){

		String fileName = file.getName();
		String extensionName =  fileName.substring(fileName.lastIndexOf(".") + 1);

		if("class".equals(extensionName)){
			return true ;
		}else{
			return false ;
		}
	}


}